package main

import (
	"fmt"
	"io"
	"log"
	"net/http"
	"os"
)

func indexHandler(w http.ResponseWriter, r *http.Request) {
	_, err := fmt.Fprintf(w, "URL.Path = %q\n", r.URL.Path)
	if err != nil {
		log.Println("print error")
	}
}

func helloHandler(w http.ResponseWriter, r *http.Request) {
	_, err := io.WriteString(w, "Hello World\n")
	if err != nil {
		log.Println("write string error")
	}
}
func main() {
	port := os.Getenv("PORT")

	http.HandleFunc("/", indexHandler)
	
	http.HandleFunc("/hello", helloHandler)
	
	log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil))
}
